package mychat.client;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;

public class ClientFrame {
	private JFrame myFrame=new JFrame("MyChat");
	private JTextArea ta1=new JTextArea();
	private JTextArea ta2=new JTextArea();
	private FlowLayout flowlayout1=new FlowLayout();
	private FlowLayout flowlayout2=new FlowLayout();
	private JPanel j1=new JPanel(new GridLayout(1,2));
	private JPanel j2=new JPanel();
	private JPanel j3=new JPanel();
	private JButton btn1=new JButton("发送");
	private JLabel l1=new JLabel("我对");
	private JComboBox combo=new JComboBox();
	private JLabel l2=new JLabel("说：");
	private JCheckBox ch=new JCheckBox("私聊");
	
	public ClientFrame(){
		Container con=myFrame.getContentPane();
		ta1.setColumns(35);
		ta1.setRows(12);
		ta2.setRows(4);
		ta2.setColumns(35);
		combo.addItem("大家");
		flowlayout1.setAlignment(FlowLayout.LEFT);
		j2.setLayout(flowlayout1);
		j2.add(l1);
		j2.add(combo);
		j2.add(l2);
		j1.add(j2);
		flowlayout2.setAlignment(FlowLayout.RIGHT);
		j3.add(ch);
		j3.add(btn1);
		j1.add(j3);
		con.add(j1,BorderLayout.CENTER);
		ta1.setEnabled(false);
		con.add(ta1,BorderLayout.NORTH);
		con.add(ta2,BorderLayout.SOUTH);
		myFrame.pack();
		myFrame.addWindowListener(new WindowAdapter(){
			public void windowClosing(WindowEvent arg0) {
				Client.cl.Close();
			}
			
		});
		myFrame.setVisible(true);
	}

}
